import request from "@/utils/axios";

class API {
  showHOST = request.config.HOST + "/attach/showPic?attachId=";
  getShowImg = (attachId, version) => {
    version = version ? "&v=" + version : "";
    return (
      request.config.HOST +
      "/uploadify/showImage?attachId=" +
      attachId +
      version
    );
  };

  HOST = request.config.HOST;
  //所有的富文本
  // tinymcePic = params => {
  //   return request.axUpload({ url: '/goods/tinymcePic', data: params })
  // }
  //主页
  getIndex = params => {
    return request.axGet({ url: "/index", data: params });
  };
  //登陆
  login = params => {
    return request.axPost({ url: "/account/login", data: params });
  };
  //角色列表
  getRoleList = params => {
    return request.axGet({ url: "/role/getRoleList", data: params });
  };

  //保存、编辑角色列表
  saveRole = params => {
    return request.axPost({ url: "/role/saveRole", data: params });
  };
  //删除角色列表
  delRole = params => {
    return request.axGet({ url: "/role/delRole", data: params });
  };

  //获取用户信息列表
  getUserList = params => {
    return request.axGet({ url: "/account/getUserList", data: params });
  };

  //删除账号
  delAccount = params => {
    return request.axGet({ url: "/account/delUser", data: params });
  };
  //更新保存用户
  saveUser = params => {
    return request.axPost({ url: "/account/saveUser", data: params });
  };

  //获取微信用户信息列表
  getUserPage = params => {
    return request.axGet({ url: "/user/getUserPage", data: params });
  };
  //删除用户
  delUser = params => {
    return request.axGet({ url: "/user/delUser", data: params });
  };
  // 文章列表
  getArticlePage = params => {
    return request.axGet({ url: "/article/getArticlePage", data: params });
  };

  // 文章分类列表/不分页
  getCategoryList = params => {
    return request.axGet({ url: "/category/getCategoryList", data: params });
  };
  // 文章分类列表/分页
  getCategoryPage = params => {
    return request.axGet({ url: "/category/getCategoryPage", data: params });
  };

  //保存文章分类
  saveCategory = params => {
    return request.axPost({ url: "/category/saveCategory", data: params });
  };

  // 删除文章分类
  delCategory = params => {
    return request.axGet({ url: "/category/delCategory", data: params });
  };

  // 文章子分类/不分页
  getChildList = params => {
    return request.axGet({ url: "/category/getChildList", data: params });
  };
  // 文章子分类/分页
  getChildPage = params => {
    return request.axGet({ url: "/category/getChildPage", data: params });
  };

  // 获取地区分类列表
  getCityPage = params => {
    return request.axGet({ url: "/city/getCityPage", data: params });
  };
  //保存地区
  saveCity = params => {
    return request.axPost({ url: "/city/saveCity", data: params });
  };
  //删除地区
  delCity = params => {
    return request.axGet({ url: "/city/delCity", data: params });
  };

  //子分类列表/不分页(分类类型是商务支援和活动及培训5/6的时候才有子分类)
  getChildList = params => {
    return request.axGet({ url: "/category/getChildList", data: params });
  };
  // 城市列表/不分页
  getCityList = params => {
    return request.axGet({ url: "/city/getCityList", data: params });
  };
  // 父级行业列表/不分页
  getParentIndustryList = params => {
    return request.axGet({ url: "/city/getParentIndustryList", data: params });
  };
  // 父级行业列表/分页
  getParentIndustryPage = params => {
    return request.axGet({ url: "/city/getParentIndustryPage", data: params });
  };

  // 删除行业
  delIndustry = params => {
    return request.axGet({ url: "/city/delIndustry", data: params });
  };
  // 保存行业
  saveIndustry = params => {
    return request.axPost({ url: "/city/saveIndustry", data: params });
  };

  // 子级行业列表/不分页
  getIndustryList = params => {
    return request.axGet({ url: "/city/getIndustryList", data: params });
  };
  // 子级行业列表/不分页
  getIndustryPage = params => {
    return request.axGet({ url: "/city/getIndustryPage", data: params });
  };

  //保存编辑文章
  saveArticle = params => {
    return request.axPost({ url: "/article/saveArticle", data: params });
  };
  //删除文章
  delArticle = params => {
    return request.axGet({ url: "/article/delArticle", data: params });
  };
  //
  // 下载模板
  downloadModel = params => {
    return request.axGet({ url: "/article/downloadModel", data: params });
  };
  //导出
  exportArticle = params => {
    return request.axGet({ url: "/article/exportArticle", data: params });
  };
  //导入
  importArticle = params => {
    return request.axUpload({ url: "/article/importArticle", data: params });
  };
  //导出第三方(活动及培训)文章
  exportOtherArticle = params => {
    return request.axGet({ url: "/article/exportOtherArticle", data: params });
  };

  //标签管理
  //标签列表/分页
  getLabelPage = params => {
    return request.axGet({ url: "/label/getLabelPage", data: params });
  };
  //保存编辑标签
  saveLabel = params => {
    return request.axPost({ url: "/label/saveLabel", data: params });
  };
  //删除标签
  delLabel = params => {
    return request.axGet({ url: "/label/delLabel", data: params });
  };

  //上传富文本图片
  tinymcePic = params => {
    return request.axUpload({ url: "/attach/tinymcePic", data: params });
  };

  // 获取口岸列表
  getPortPage = params => {
    return request.axGet({ url: "/port/getPortPage", data: params });
  };
  // 获取口岸详情
  getPort = params => {
    return request.axGet({ url: "/port/getPort", data: params });
  };
  //新增口岸
  savePort = params => {
    return request.axPost({ url: "/port/savePort", data: params });
  };
  //删除口岸
  delPort = params => {
    return request.axGet({ url: "/port/delPort", data: params });
  };

  // 获取铁路列表
  getRailwayPage = params => {
    return request.axGet({ url: "/port/getRailwayPage", data: params });
  };
  // 获取铁路列表/不分页
  getRailwayList = params => {
    return request.axGet({ url: "/port/getRailwayList", data: params });
  };
  // 获取铁路详情
  getRailway = params => {
    return request.axGet({ url: "/port/getRailway", data: params });
  };
  //新增铁路
  saveRailway = params => {
    return request.axPost({ url: "/port/saveRailway", data: params });
  };
  //删除铁路
  delRailway = params => {
    return request.axGet({ url: "/port/delRailway", data: params });
  };

  // 获取关于我们列表
  getQuestionPage = params => {
    return request.axGet({ url: "/question/getQuestionPage", data: params });
  };
  //新增关于我们
  saveQuestion = params => {
    return request.axPost({ url: "/question/saveQuestion", data: params });
  };
  //删除关于我们
  delQuestion = params => {
    return request.axGet({ url: "/question/delQuestion", data: params });
  };

  //获取答案
  getAnswerList = params => {
    return request.axGet({ url: "/question/getAnswerList", data: params });
  };
  //新增编辑答案
  saveAnswer = params => {
    return request.axPost({ url: "/question/saveAnswer", data: params });
  };

  //获取帮助详情
  getHelp = params => {
    return request.axGet({ url: "/help/getHelp", data: params });
  };
  //获取帮助列表/分页
  getHelpPage = params => {
    return request.axGet({ url: "/help/getHelpPage", data: params });
  };
  //删除帮助
  delHelp = params => {
    return request.axGet({ url: "/help/delHelp", data: params });
  };

  //新增帮助详情
  saveHelp = params => {
    return request.axPost({ url: "/help/saveHelp", data: params });
  };

  //获取角色和菜单
  getMenuAndRole = params => {
    return request.axGet({ url: "/menu/getMenuAndRole", data: params });
  };

  //获取菜单列表
  getMenuList = params => {
    return request.axGet({ url: "/menu/getMenuList", data: params });
  };

  //保存编辑角色菜单
  saveRoleMenu = params => {
    return request.axPost({ url: "/menu/saveRoleMenu", data: params });
  };
  //获取标签列表/不分页
  getLabelList = params => {
    return request.axGet({ url: "/label/getLabelList", data: params });
  };
  //新增/编辑/删除用户偏好
  savePreference = params => {
    return request.axGet({ url: "/user/savePreference", data: params });
  };

  //新增/编辑/删除用户偏好
  getPreferenceList = params => {
    return request.axGet({ url: "/user/getPreferenceList", data: params });
  };

  // 上传视频
  uploadVideo = params => {
    return request.axUpload({
      url: "/attach/uploadVideo",
      data: params
    });
  };

  //***************************广告****************************** */
  //获取广告信息列表
  getPosterPage = params => {
    return request.axGet({ url: "/poster/getPosterPage", data: params });
  };

  //删除广告
  delPoster = params => {
    return request.axGet({ url: "/poster/delPoster", data: params });
  };

  //新增编辑广告
  savePoster = params => {
    return request.axUpload({ url: "/poster/savePoster", data: params });
  };

  //广告详情
  getPoster = params => {
    return request.axGet({ url: "/poster/getPoster", data: params });
  };

  //文章置顶/置底
  setTop = params => {
    return request.axPost({ url: "/article/setTop", data: params });
  };

  //获取不属于全部的分类
  getNotAll = params => {
    return request.axGet({ url: "/category/getNotAll", data: params });
  };

  //文章详情
  getArticle = params => {
    return request.axGet({ url: "/article/getArticle", data: params });
  };

  //删除模块文章
  delAllArticle = params => {
    return request.axGet({ url: "/article/delAllArticle", data: params });
  };

  // 保存多篇文章
  saveManyArticle = params => {
    return request.axPost({ url: "/article/saveManyArticle", data: params });
  };
}
export default new API();
